<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    //案例：输入分数，判定成绩等级 - switch
    var score = prompt('请输入分数0-100：');
    switch (true) {
        case score == 100:
            console.log('A');
            break;
        case score >= 90 && score < 100:
            console.log('B');
            break;
        case score >= 80 && score < 90:
            console.log('C');
            break;
        case score >= 60 && score < 80:
            console.log('D');
            break;
        case score >= 0 && score < 60:
            console.log('E');
            break;
        default:
            console.log('输入有误');
    }
</script>